package br.com.absolutech.study.chapter6.pag277;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 
 * @author romulo.freitas
 * 
 * suggested program arguments:
 * "\d\w" "ab4 56_7ab"
 *
 */
public class Regex {

	public static void main(String[] args) {

		Pattern p = Pattern.compile(args[0]);
		Matcher m = p.matcher(args[1]);
		boolean b = false;
		System.out.println("Pattern is " + m.pattern());
		while (b = m.find()) {
			System.out.println(m.start() + " " + m.group());
		}

	}
}
